import canvasAbstract from "./canvasAbstract";
import model from "../model/play";
import config from "../config";
export default new class extends canvasAbstract implements ICanvas {
  stop?(): void {
    throw new Error("Method not implemented.");
  }
  public life: number = 100;
  name: string = "play";
  num(): number {
    return 1;
  }
  lifeNum = 3;
  model(): IModelConstructor {
    return model;
  }
  render(): void {
    this.createModels();
    super.renderModels();
  }

  createModels(): void {
    const cw = config.canvas.width;
    const ch = config.canvas.height;
    const mw = config.model.width;
    const mh = config.model.height;
    [{ x: cw / 2 + mw * 4, y: ch - mh }].forEach(position => {
      const model = this.model() as IModelConstructor;
      const instance = new model(position.x, position.y);
      this.models.push(instance);
    });
  }
}("play");
